<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-touch-fullscreen" content="yes">
  <meta name="msapplication-tap-highlight" content="no">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>用户登录</title>
  <link rel="shortcut icon" href="/favicon.ico">
  <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/bootstrap-4.2.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="${pageContext.request.contextPath }/user/SUI_Mobile/sm.min.css">
  <link rel="stylesheet" href="${pageContext.request.contextPath }/user/SUI_Mobile/sm-extend.min.css">
  <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/user/css/common.css">
  <style type="text/css">
    .label{
      width: 130px;
    }    
    .list-block{
      padding: 5px 0px;
    }
    ul{
      padding: 2px 0px;
    }
    ul li{
      padding-top: 10px;
    }
    ul::before,ul::after{
      border: 1px solid #fff;
    }
    /* input自动填入，input变黄色 */
    input:-webkit-autofill { 
      box-shadow: 0 0 0px 1000px white inset !important;
    }
  </style>
</head>
<body>
  <div class="container">
    <header class="bar bar-nav header sticky-top">
      <h1 class='title'>用户登录</h1>
    </header>
    <!-- 中间，记录显示 -->
    <div class="mainContent">
      <form id="loginUserForm" class="list-block" style="border:0px solid red;margin-bottom: 0px;margin-top:50px;">
      <div class="text-center loginErrorInfo" style="color:#f00;display:none;padding: 10px 0px;">账号或密码错误</div>
        <ul>
          <li>
            <div class="item-content">
              <div class="item-inner">
                <div class="label">用户名</div>
                <div class="item-input">
                  <input type="text" value="" placeholder="请输入用户名" class="username">
                </div>
              </div>
            </div>
          </li>
          <li>
            <div class="item-content">
              <div class="item-inner" style="border-bottom: 0.5px solid #E7E7E7;margin-bottom: 2px;">
                <div class="label">密 码</div>
                <div class="item-input">
                  <input type="password" value="" class="password" placeholder="请输入密码">
                </div>
              </div>
            </div>
          </li>
        </ul>
      </form>
      <div class="registerInfo text-right" style="padding: 18px 25px;">
        <a href="register.jsp" style="font-size: 18px;color: #aaa;">还没账号？点我 <strong style="color:#777;">注册</strong> </a>
      </div>
      <div class="content-block" style="margin-top: 0px;">
        <div class="row">
          <div class="col"><a href="javascript:;" class="button button-big button-fill button-success confirmLoginBtn">确定</a></div>
        </div>
      </div>
    </div><!-- end of .mainContent -->
  </div> <!-- end of .container -->

  <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-3.3.1.min.js" charset="utf-8"></script>
  <script type='text/javascript' src='${pageContext.request.contextPath }/user/SUI_Mobile/zepto.min.js' charset='utf-8'></script>
  <script type='text/javascript' src='${pageContext.request.contextPath }/user/SUI_Mobile/sm-extend.min.js' charset='utf-8'></script>
  <script type="text/javascript" src="${pageContext.request.contextPath }/bootstrap-4.2.1/js/bootstrap.min.js" charset="utf-8"></script>
  <script>
    $(function () {
    	// 登陆按钮
      $('.confirmLoginBtn').on('click', function () {
    	  if($('.username').val()==""||$('.username').val()==null){
    		  $('.username').focus()
    	  }else if ($('.password').val()==""||$(".password").val()==null){
    		  $('.password').focus()
    	  }else{
    		  var username = $('.username').val()
    		  var password = $('.password').val()
    		  $.post(
    			  "/LostAndFound/login?method=userLogin",
    			  {
    				  "username":username,
    				  "password":password
    			  },
    			  function(data){
    				  if(!data.success){
    					  $('.loginErrorInfo').css('display','block')
    				  } else {
    					  window.location.href="/LostAndFound/user/01/home.jsp"
    				  }
    			  },
    			  "json"
    		  );
    	  }
      })
    })
  </script>
</body>
</html>